
// 时间戳转换为时间字符串 YYYY-MM-DD HH:mm:ss
export function dateFormat(timeStamp) {
    timeStamp = (timeStamp + '').length === 10 ? timeStamp * 1000 : timeStamp
    const dt = new Date(timeStamp)
    const Y = dt.getFullYear()
    const m = (dt.getMonth() + 1 + '').padStart(2, '0')
    const d = (dt.getDate() + '').padStart(2, '0')
    const H = (dt.getHours() + '').padStart(2, '0')
    const i = (dt.getMinutes() + '').padStart(2, '0')
    const s = (dt.getSeconds() + '').padStart(2, '0')

    return `${Y}-${m}-${d} ${H}:${i}:${s}`
}

